<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('新增菜单')"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-menu-add">
        <div class="form-group">
            <label class="col-sm-3 control-label">父级路径：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" th:value="${url}" readonly="readonly" name="url"
                       id="url" required>
            </div>
        </div>

        <div th:if="${envs == null}" class="form-group">
            <label class="col-sm-3 control-label">配置名称：</label>
            <div class="col-sm-8">
                <input name="name" class="form-control" type="text">
            </div>
        </div>

        <div th:if="${envs != null}" class="form-group">
            <label class="col-sm-3 control-label">配置名称：</label>
            <div class="col-sm-8">
                <select name="name" class="form-control">
                    <option th:each="env : ${envs}" th:text="${env}" th:value="${env}"></option>
                </select>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">配置内容：</label>
            <div class="col-sm-8">
                <textarea rows="6" name="text" class="form-control"></textarea>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">备注信息：</label>
            <div class="col-sm-8">
                <textarea rows="6" name="remark" class="form-control"></textarea>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<script>

    $("#form-menu-add").validate({
        rules: {
            name: {
                required: true
            },
        }
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(ctx + "config/center/node/add", $('#form-menu-add').serialize());
        }
    }

</script>
</body>
</html>
